<#-- /**
 * 自定义模板
 * Created by 张栋 on 2016/11/2 14:33
 */-->
<#--select-->
<#macro select id="" name=""  attr="" options={} val="" >
    <select id="${id!}" name="${name!}" ${attr!} >
        <#if options?is_hash>
            <#list options?keys as key>
                <option value="${key?html}"<@checkSelected key val />>${options[key]?html}</option>
            </#list>
        <#else>
            <#list options as value>
                <option value="${key?html}"<@checkSelected key val />>${key?html}</option>
            </#list>
        </#if>
    </select>
</#macro>
<#macro checkSelected key val >
    <#if key?? && val??  && key == val >selected="selected"</#if>
</#macro>


<#--checkbox-->
<#macro checkbox id="" name="" value="" checked=false val=""  attr="" >
        <input   type="checkbox"  ${attr}  id="${id}" name="${name}"  value="${value}"
        <#if (val!="")  >
               <#if val==value >
                checked="checked"
               </#if>
        <#else>
            <#if checked >
               checked="checked"
            </#if>
        </#if>
        >
</#macro>

